From: | Christian Hattemer |
Date: | 01 Aug 99 at 16:55:16 |
Subject: | Re: Building structures dynamically |
From: Christian Hattemer <Chris@heaven.riednet.wh.tu-darmstadt.de>
On 30-Jul-99 Gabriele Svelto wrote:
> If I have understood your problem you need to create an array of Data
> structures which can be different (for example TEXT String could be of
> another size etc...). You could then create the Data structure only using
> pointers like that:
> sruct Data
> {
> TEXT *String; (is TEXT a #define of char?)
It's typedef unsigned char TEXT; (from exec/types.h)
> ULONG Num;
> }
This could be used if no other way could be found, but it's not what I
originally wanted.
I should have mentioned this aspect of my idea already in the first posting:
The generated struct must look exactly the same as if it was completely
written in the source.
The program operates on a struct like this:
struct IListNode
{
ULONG Status;
ULONG Priority;
TEXT Title[MAX_TEXT];
TEXT Textfile[PATH_LEN];
};
This is the Node struct for each listentry in a certain program.
It's used whenever actions on the list are taken.
It's also used to save the contents of the list to an ASCII config file.
The problem is to rebuild exactly this struct when loading the data again.
When reading, an array of exactly this struct needs to be build in order to
be able to use it directly with MUIM_List_Insert.
To be able to use the routine in several programs without changing to code,
and to be able to use it in the same program for different kinds of lists
the layout of the struct to be built should be passed in via the ReadConfig
array described in my first posting.
So there are two "sides": The main program which has the full layout of the
struct available and the ReadConfig() function which only gets the layout
described in the ReadConfig array it gets passed in.
Bye, Chris
"Das neue Windows 95 kann einfach alles, dank 32 Bit.
Wenn ich 32 Bit getrunken habe, glaube ich auch immer,
da� ich alles kann!" T. Koschwitz